import request from "../../utils/request";

const BASE_URL = "maimao_info/info/address";
export default {

    /**
     * 添加地址
     */
    add(address) {
        return request({
            url: `${BASE_URL}/add`,
            method: 'post',
            data: address
        })
    },
    /**
     * 更新地址
     */
    update(address) {
        return request({
            url: `${BASE_URL}/update`,
            method: 'post',
            data: address
        })
    },
    /**
     * 登录用户的所有收货地址
     */
    userAddressData() {
        return request({
            url: `${BASE_URL}/list/login`,
            method: 'get',

        })
    },
    /**
     * 设为默认
     * @param id
     * @returns {AxiosPromise}
     */
    updateDefault(id) {
        return request({
            url: `${BASE_URL}/set-default`,
            method: 'post',
            data: {
                id
            }

        })
    },
    /**
     * 删除地址
     * @param id
     * @returns {AxiosPromise}
     */
    deleteAddress(id) {
        return request({
            url: `${BASE_URL}/delete`,
            method: 'delete',
            data:{
                id
            }
        })
    }


}

